package com.taptech.doufu.ui.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.taptech.doufu.R
import com.taptech.doufu.constant.SPKey
import com.taptech.doufu.ui.activity.base.DiaobaoBaseActivity
import com.taptech.doufu.util.sp.DiaoBaoSharedPreferences
import kotlinx.android.synthetic.main.activity_youth_mode.*

class YouthModelActivity:DiaobaoBaseActivity() {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_youth_mode)
        val pwd = DiaoBaoSharedPreferences.getSharedPreferencesValueToString(SPKey.YOUTH_MODEL_PWD, this, "")
        if (pwd!=null && pwd.isNotEmpty()){
            tvTitle.text = "青少年模式已开启"
            btnClose.visibility = View.VISIBLE
            btnOpen.visibility = View.GONE
            btnChangePwd.visibility = View.VISIBLE
        }else{
            tvTitle.text = "青少年模式未开启"
            btnClose.visibility = View.GONE
            btnOpen.visibility = View.VISIBLE
            btnChangePwd.visibility = View.GONE
        }

        btnClose.setOnClickListener {
            YouthModelCloseActivity.startActivity(thisActivity)
        }

        btnOpen.setOnClickListener {
            YouthModelSetPwdActivity.startActivity(thisActivity)
        }

        btnChangePwd.setOnClickListener {
            YouthModelChangePwdActivity.startActivity(thisActivity)
        }
    }


    companion object{

        fun startActivity(context: Context) {
            val intent = Intent()
            intent.setClass(context,YouthModelActivity::class.java)
            context.startActivity(intent)
        }
    }
}